<%@page import="com.zx.oa.entity.ClassInfo"%>
<%@page import="com.zx.oa.utils.PageSupport"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../common/header.jsp"%>
<%@page import="com.zx.oa.service.student.StudentService"%>
<%@page import="com.zx.oa.service.student.StudentService"%>
<%@page import="com.zx.oa.entity.Student"%>
<%@page import="java.util.List"%>
<%@page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath }"></c:set>
<script src="js/jquery-3.5.1.js" type="text/javascript"></script>
<style>
    .bbtt {
        margin-left: 87px;
        margin-top: 10px;
    }
</style>
<script>
    function confirmAct(){
        if(confirm('确定要执行删除操作吗?')){
            return true;
        }
        return false;
    }
</script>
<!-- appInfoList页面开始 -->
<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
            <h2>
                学生管理维护<i class="fa fa-user"></i> ${loginName }
            </h2>
            <!--  -->
            <div class="x_content">
                <br />
                <form id="query" data-parsley-validate
                      class="form-horizontal form-label-left" method="post"
                      action="chaservlet.do">
                    <ul style="list-style: none; display: inline-block;">
                        <li><label class="control-label col-md-3 col-sm-3 col-xs-12"
                                   >专业 </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <select name="major" value="${param.major==null?"":param.major}" id="major"
                                        class="form-control col-md-7 col-xs-12">
                                    <option value="">---请选择---</option>
                                    <c:forEach var="maj" items="${majors}">
                                        <option value="${maj.major}" ${param.major eq maj.major?'selected':''}>${maj.major}</option>
                                    </c:forEach>
                                </select>
                            </div></li>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                       >班级 </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <select name="classname" id="classname" value="${param.classname==null?"":param.classname}"
                                            class="form-control col-md-7 col-xs-12">
                                        <option value="">---请选择---</option>
                                        <c:forEach var="clist" items="${cList }">
                                            <option value="${clist.className}"
                                                ${param.classname eq clist.className?'selected':''}
                                            >${clist.className}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">姓名
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" name="namec" value="${name=null?'':name}"
                                           class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                        </li>
                        <br />
                        <li>
                            <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <button type="submit" class="btn btn-primary bbtt"
                                            class="btn btn-success ">查&nbsp;&nbsp;&nbsp;&nbsp;询</button>
                                </div>
                            </div>
                        </li>
                    </ul>
                </form>
            </div>
        </div>
    </div>
    <!-- 表格 -->
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
            <a href="jsp/studentadd.jsp" class="btn btn-success btn-sm">注册学生信息</a>
            <a href="excelservlet.do" class="btn btn-success btn-sm">导出学生信息</a>
                <table id="datatable" class="table table-striped table-bordered">
                    <tr>
                        <th>学号</th>
                        <th>姓名</th>
                        <th>专业</th>
                        <th>班级</th>
                        <th>来自院校</th>
                        <th>学历</th>
                        <th style="width: 125px;">操作</th>
                    </tr>
                    <c:forEach var="stu" items="${studentList}">
                        <tr>
                            <td>${ stu.studentId }</td>
                            <td>${ stu.studentName }</td>
                            <td>${ stu.studentMajor }</td>
                            <td>${ stu.studentClass }</td>
                            <td>${ stu.studentFromSchool }</td>
                            <td>${ stu.education }</td>
                            <td>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-danger">点击操作</button>
                                    <button type="button" class="btn btn-danger dropdown-toggle"
                                            data-toggle="dropdown" aria-expanded="false">
                                        <span class="caret"></span> <span class="sr-only">Toggle
											Dropdown</span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a
                                                href="modifyServlet.do?stuNo=${ stu.studentId }&param=cha&major=${ stu.studentMajor }&className=${ stu.studentClass }&pageIndex=${pageInfo.currentPageNo}&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major1=${param.major==null?'':param.major}"
                                                data-toggle="tooltip" data-placement="top"
                                                data-original-title="修改学生信息">修改</a></li>
                                        <li><a href="delservlet.do?stuNo=${ stu.studentId }&pageIndex=${pageInfo.currentPageNo}&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major=${param.major==null?'':param.major}"
                                               data-toggle="tooltip" data-placement="top"
                                               data-original-title="删除学生信息" onclick="return confirmAct();">删除</a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    </c:forEach>
                    <tr>
                        <td colspan="10" style="text-align: right;"><span>共有${pageInfo.totalCount }条数据，${pageInfo.currentPageNo }/${pageInfo.totalPageCount }页</span>
                            <a
                                    href="chaservlet.do?pageIndex=1&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major=${param.major==null?'':param.major}">首页</a>&nbsp;
                            <c:choose>
                                <c:when test="${pageInfo.currentPageNo ==1}">
                                    <a
                                            href="chaservlet.do?pageIndex=1&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major=${param.major==null?'':param.major}">上一页</a>&nbsp;
                                </c:when>
                                <c:otherwise>
                                    <a
                                            href="chaservlet.do?pageIndex=${pageInfo.currentPageNo-1}&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major=${param.major==null?'':param.major}">上一页</a>&nbsp;
                                </c:otherwise>
                            </c:choose>
                            <c:choose>
                                <c:when test="${pageInfo.currentPageNo==pageInfo.totalPageCount}">
                                    <a
                                            href="chaservlet.do?pageIndex=${pageInfo.totalPageCount}&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major=${param.major==null?'':param.major}">下一页</a>&nbsp;
                                </c:when>
                                <c:otherwise>
                                    <a
                                            href="chaservlet.do?pageIndex=${pageInfo.currentPageNo+1}&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major=${param.major==null?'':param.major}">下一页</a>&nbsp;
                                </c:otherwise>
                            </c:choose>
                            <a
                                    href="chaservlet.do?pageIndex=${pageInfo.totalPageCount}&namec=${name==null?'':name}&classname=${param.classname==null?'':param.classname}&major=${param.major==null?'':param.major}">末页</a>
                        </td>
                    </tr>
                </table>
        </div>
    </div>
</div>

<!-- appInfoList页面结束 -->
<!-- /page content -->
<%@ include file="../common/footer.jsp"%>
<script src="${ctx }/statics/localjs/studentAjax.js"></script>

